/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package prototype.runtime.porticoutils;

import hla.rti.LogicalTime;
import hla.rti.LogicalTimeInterval;
import org.portico.impl.hla13.types.DoubleTime;
import org.portico.impl.hla13.types.DoubleTimeInterval;

/**
 *
 * @author Server
 */
public class PorticoUtils {


    /**
     * As all time-related code is Portico-specific, we have isolated it into a
     * single method. This way, if you need to move to a different RTI, you only need
     * to change this code, rather than more code throughout the whole class.
     */
    public static LogicalTime convertTime(double time) {

        // PORTICO SPECIFIC!!
        return new DoubleTime(time);
    }

    /**
     * Same as for {@link #convertTime(double)}
     */
    public static LogicalTimeInterval convertInterval(double time) {

        // PORTICO SPECIFIC!!
        return new DoubleTimeInterval(time);
    }

    public static double convertTime(LogicalTime logicalTime) {
        // PORTICO SPECIFIC!!
        return ((DoubleTime) logicalTime).getTime();
    }
}
